#-*- coding:utf-8 -*-

#一级类型定义
SMART_TYPE_FORUM = 1
SMART_TYPE_HOUSE = 2
SMART_TYPE_TRADE = 3


# [一级分类]
SmartConf = {}
SmartConf[1] = {"name":"邻居论坛"}
SmartConf[2] = {"name":"二手交易"}
SmartConf[3] = {"name":"物业租售"}


# [二级分类] 论坛
SmartConf[100] = {"name":"物业管理",  "desc":"让咱们的小区生活更美好", "comment":True}
SmartConf[101] = {"name":"没事唠嗑",  "desc":"好邻居就一起唠嗑吧", "comment":True}
SmartConf[102] = {"name":"邻居帮帮忙",  "desc":"远亲不如近邻", "comment":True}
SmartConf[103] = {"name":"邻居知道",  "desc":"生活琐事，终身大计，不如问问邻居吧", "comment":True}
SmartConf[104] = {"name":"活动召集",  "desc":"好邻居们组织起来一起聚聚吧", "comment":True}
SmartConf[105] = {"name":"妈咪圈",  "desc":"好邻居们组织起来一起聚聚吧", "comment":True}
SmartConf[106] = {"name":"小区印象",  "desc":"瞬间发现身边的美", "comment":True}
SmartConf[107] = {"name":"游戏公会",  "desc":"咱邻居的游戏公会,一起游戏一起玩", "comment":True}
SmartConf[108] = {"name":"论坛建议",  "desc":"亲,我们期待你的一切反馈哦", "comment":True}
SmartConf[109] = {"name":"技术测试",  "desc":"智能表单技术测试!", "comment":True,
        "fields": [
            {"tag":"价格", "name":"price", "type":"uint"} ,   
            {"tag":"公司", "name":"company", "type":"string", "maxlen":30} ,   
            {"tag":"成色", "name":"chengshe", "type":"choice", "choices":[
                {"tag":"全新", "value":"1"}, 
                {"tag":"二手", "value":"2"}, 
                ]
            } ,   

            {"tag":"品牌", "name":"band", "type":"select", "selects":[
                {"tag":"iphone", "value":1},
                {"tag":"三星", "value":2},
                {"tag":"华为", "value":3},
                ]} ,   
            ]
        }


# [二级分类] 二手交易
SmartConf[201] = {"name":"家具", "comment":False}
SmartConf[202] = {"name":"电器", "comment":False}
SmartConf[203] = {"name":"数码产品", "comment":False}
SmartConf[204] = {"name":"母婴用品", "comment":False}
SmartConf[204] = {"name":"儿童玩具", "comment":False}
SmartConf[205] = {"name":"服装首饰", "comment":False}
SmartConf[205] = {"name":"宠物", "comment":False}
SmartConf[206] = {"name":"免费赠送", "comment":False}

# [二级分类] 房屋租售
SmartConf[301] = {"name":"住房", "comment":False}
SmartConf[302] = {"name":"商铺", "comment":False}
SmartConf[303] = {"name":"写字楼", "comment":False}
SmartConf[304] = {"name":"停车位", "comment":False}

for k, v in SmartConf.items(): 
    SmartConf[k]["id"] = k

    if k < 100: continue
    f = SmartConf[k]
    if not f.has_key('fields'):
        f['fields'] = []

    f['fields'].insert(0, {"tag":"标题", "name":"title", "type":"string", "maxlen":40})
    f['fields'].insert(len(f['fields']), {"tag":"内容", "name":"content", "type":"text", "maxlen":4096})
    

def getSubTypeList(parent_type_id):
    return [ v for v in SmartConf.values() if v['id']/100 == parent_type_id ]


def isValidTypeId(typeid):
    return SmartConf.has_key(typeid)

